package com.topvision.bureau.view.regmode;

import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;

import java.util.List;

/**
 * Created by gushenjie on 17/6/18.
 */

public class RegModeFragmentAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> mFragments;

    public RegModeFragmentAdapter(FragmentManager fm) {
        super(fm);
    }

    public RegModeFragmentAdapter(FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        mFragments = fragments;
    }

    @Override
    public Fragment getItem(int arg0) {
        return mFragments.get(arg0);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }



    /**
     * 更新视图
     *
     * @param mFragments
     */
    public void updateData(List<Fragment> mFragments) {
        this.mFragments = mFragments;
        notifyDataSetChanged();
    }


    @Override
    public Parcelable saveState() {
        return null;
    }

    @Override
    public int getItemPosition(Object object) {
        return PagerAdapter.POSITION_NONE;
    }

}
